import os

DEBUG = False
#--- 设置MySQL DB 信息
MYSQL_DBNAME = "db_st"
MYSQL_DBHOST = '10.129.7.200'
MYSQL_DBPORT = '3306'
MYSQL_DBUSER = "user1"
MYSQL_DBPASSWORD = 'Beaconuser1!'
# ---设置MySQL DB 信息

MQTT = '10.129.4.155:8002'  # MQTT服務，MQTT IP + 端口

DOWNLOAD_URL = 'http://10.129.4.97:90/'  # 项目IP + 端口

# ---Redis 相关配置
REDIS_HOST = '10.129.4.80'  # Redis缓存服务器IP
REDIS_BK_HOST = '10.129.4.79'  # Redis备用缓存服务器IP
REDIS_PASSWORD = "nxkAdmin168!"  # Redis服务器登陆密码(10.129.4.79)
REDIS_PORT = 6379  # 端口号
REDIS_DB = 4  # 连接的Redis数据库号
REDIS_HEAD_SEQ = "ST:"  # redis写入缓存数据时的Key头部符号
REDIS_CONNECT_SEQ = ":"  # redis写入缓存数据时的连接符
# REDIS_ON = True                    # redis 开启           # 这个开关仅能关掉数据优化层面的Redis调用
REDIS_ON = False  # redis 关闭        # 系统数据层面的Redis是无法用这个开关关闭的
REDIS_CACHE_TIME = 60 * 60 * 2  # 設置Redis的緩存時間
#---Redis 相关配置

LINUX_ROOT = "/fileData2/ST/"  # Linux真实存放文件目录
WIN_ROOT = "D:/photos/files/ST/"  # Windows存放文件目录
FILE_ROOT_URL = '/files/'  # 网络地址替代MEDIA_ROOT

SYSTEM_ADDRESS = "http://st.foxconn.com/"

DEFAULT_CHARSET = 'utf-8'
CONNECTOR = '-'  # 连接符
DATA_DEFAULT_FORMAT = 'json'  # 默认数据格式
ENCODING = DEFAULT_CHARSET  # 默认的编码方式

MAX_ORG_LEVEL = 10  # 最大的ORG等级
REST_FRAMEWORK = {
    "DATETIME_FORMAT": "%Y-%m-%d %H:%M:%S",
    # "UNICODE_JSON": False,
} #全局变量时间格式

#---网络地址与实际地址
WORKFLOW_IMG_URL = "workflow/img/"
WORKFLOW_IMG_URL2 = "/files/workflow/img/"
WORKFLOW_FILE_URL = "workflow/file/"
WORKFLOW_FILE_URL2 = "/files/workflow/file/"
WORKFLOW_FILE_PDF = "workflow/pdf/"
FILE_PDF = "pdf/"

DRAWING_PATH = "file_manager/drawing/"
ATTACHMENT_PATH = "file_manager/attachment/"

FORMS_URL = "/files/forms/pdf/"

FORMS_EXCEL = "forms/excel/"
FORMS_FILE = "forms/pdf/"
# FONT_PATH = 'pdf/'
#---网络地址与实际地址

if os.name == "nt":  # nt 是Windows的代號
    ALLOWED_HOSTS = ["*"]
    MEDIA_ROOT =  WIN_ROOT # Windows存放文件目录
else:  # 服务器端的配置
    ALLOWED_HOSTS = ["*"]
    MEDIA_ROOT = LINUX_ROOT  # Linux真实存放文件目录
# 数据库设置
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': MYSQL_DBNAME,
        'HOST': MYSQL_DBHOST,
        'PORT': MYSQL_DBPORT,
        'USER': MYSQL_DBUSER,
        'PASSWORD': MYSQL_DBPASSWORD,
    },
    'db1': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'db_st',
        'HOST': '10.129.7.200',
        'PORT': 3306,
        'USER': 'user1',
        'PASSWORD': 'Beaconuser1!',
    },
        'db2': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'db_st_ims',
        # 'HOST': '10.129.4.131',
        #  'USER': 'root',
        #  'PASSWORD': 'Foxconn168!'
        'HOST': '10.129.7.200',
        'PORT': 3306,
        'USER': 'user1',
        'PASSWORD': 'Beaconuser1!',
    },
}
DATABASE_ROUTERS = ['ST1.database_router.DatabaseAppsRouter']
DATABASE_APPS_MAPPING = {
    # example:
    # 'app_name':'database_name',
    'thdata': 'db1',
    'ims': "db2",
    'smart_cutter':'db2'
}
# 数据库设置

EMAIL_TEMPLATE = {  # 郵件模板的默認參數
    "HOST": SYSTEM_ADDRESS ,  # 系統地址
    "Manager": "李遺瓊 560-27214 ；袁光偉 560-27226；田明鈺 560-27215",  # 管理員信息
}
